{include_core file="m/lib/header.html" center="center" title="修改基本资料"}
<script>
$(function(){
	var year  = {$birthday['0']};
	var month = {$birthday['1']};
	var day   = parseInt({$birthday['2']});
	var daynum = getDaysInOneMonth(year, month);
	var dayHtml = '';
	for (var i=1; i<=daynum; i++) {
		if(i == day) {
			dayHtml += '<option value="'+i+'" selected>'+i+'</option>'
		} else {
			dayHtml += '<option value="'+i+'" >'+i+'</option>'
		}
	}
  if(day != '0') {
    $('#birthdayDay').prev().html(day+'日');
  } else {
    $('#birthdayDay').prev().html('请选择');
  }
	$('#birthdayDay').html(dayHtml);

	$('.people-sel .item .arrow').click(function(){
		$(this).siblings('ul').toggle();
	});
	$('.people-sel-sex select').change(function(){
		var gender = $(this).val();
		if(gender == 0) {
			var people_gender = '女';
		} else if(gender == 1) {
			var people_gender = '男';
		} else {
			var people_gender = '保密';
		}
		$(this).prev().html(people_gender);
	});
	$('#birthdayYear').change(function(){
		var year = $(this).val();
		$(this).prev().html(year+'年');
		var month = $('#birthdayMonth').val();
		var daynum = getDaysInOneMonth(year, month);
		var dayHtml = '';
		for (var i=1; i<=daynum; i++) {
			dayHtml += '<option value="'+i+'" >'+i+'</option>'
		}
		$('#birthdayDay').prev().html('1日');
		$('#birthdayDay').html(dayHtml);
	});
	$('#birthdayMonth').change(function(){
		var month = $(this).val();
		var year  = $('#birthdayYear').val();
		var daynum = getDaysInOneMonth(year, month);
		var dayHtml = '';
		for (var i=1; i<=daynum; i++) {
			dayHtml += '<option value="'+i+'" >'+i+'</option>'
		}
		$('#birthdayDay').prev().html('1日');
		$('#birthdayDay').html(dayHtml);
		$(this).prev().html(month+'月');
	});
	$('#birthdayDay').change(function(){
		var day = $(this).val();
		$(this).prev().html(day+'日');
	});


	$('#userInfoBtn').click(function(){
      var nickname = $.trim($('#nickName').val());
      var realname = $.trim($('#reanName').val());
      var day = $('#birthdayDay').val();
      if(getStringLen(day) == 1) {
        day = '0' + day;
      }
      var birthdayDate = $.trim($('#birthdayYear').val()+'-'+$('#birthdayMonth').val()+'-'+day);
      var datas = { nickname:nickname, realname:realname, birthday:birthdayDate }
      $.post("{AnUrl('user/setting/save')}",datas,
        function(data){
          if(data.info == 'error') {
            mobileShowMsg(data.msg);
            return;
          } else {
            $('#saveForm').submit();
          }
        }, 'json');
    });
});
</script>
<div class="data-edit-page">
	<form action="{AnUrl('user/setting/save')}" id="saveForm" method="post">
	<p class="tit">昵称</p>
    <div class="txt-box"><input type="text" id="nickName" name="nickname" value="{$user_info.nickname}"/></div>
    <p class="tit">真实姓名</p>
    <div class="txt-box"><input type="text" id="realName" name="realname" value="{$user_info.realname}"/></div>
    <p class="tit">性别</p>
    <div class="people-sel people-sel-sex clearfix">
      <div class="item">
        <span>{if $user_info.gender == '1'}男{elseif $user_info.gender == '0'}女{else}保密{/if}</span>
        <select name="gender"><option {if $user_info.gender == '1'}selected{/if} value="1">男</option><option {if $user_info.gender == '0'}selected{/if} value="0">女</option><option {if $user_info.gender == '2'}selected{/if} value="2">保密</option></select>
        <a href="javascript:void(0);" class="arrow"></a>
      </div>
    </div>
    <p class="tit">生日</p>
    <div class="people-sel people-sel-time clearfix">
      <div class="item">
        <span>{if $birthday['0'] == '0000'}请选择{else}{$birthday['0']}年{/if}</span>
        <select name="birthdayyear" id="birthdayYear">
        	{for $year=1940 to date('Y', time())}
        	<option {if $birthday['0'] == $year}selected{/if} value="{$year}">{$year}</option>
        	{/for}
        </select>
        <a href="javascript:void(0);" class="arrow"></a>
      </div>
      <div class="item">
        <span>{if $birthday['1'] == '00'}请选择{else}{$birthday['1']}月{/if}</span>
        <select name="birthdaymonth" id="birthdayMonth">
        	<option {if $birthday['1'] == '01'}selected{/if} value="01">1</option>
        	<option {if $birthday['1'] == '02'}selected{/if} value="02">2</option>
        	<option {if $birthday['1'] == '03'}selected{/if} value="03">3</option>
        	<option {if $birthday['1'] == '04'}selected{/if} value="04">4</option>
        	<option {if $birthday['1'] == '05'}selected{/if} value="05">5</option>
        	<option {if $birthday['1'] == '06'}selected{/if} value="06">6</option>
        	<option {if $birthday['1'] == '07'}selected{/if} value="07">7</option>
        	<option {if $birthday['1'] == '08'}selected{/if} value="08">8</option>
        	<option {if $birthday['1'] == '09'}selected{/if} value="09">9</option>
        	<option {if $birthday['1'] == '10'}selected{/if} value="10">10</option>
        	<option {if $birthday['1'] == '11'}selected{/if} value="11">11</option>
        	<option {if $birthday['1'] == '12'}selected{/if} value="12">12</option>
        </select>
        <a href="javascript:void(0);" class="arrow"></a>
      </div>
      <div class="item">
        <span>{if $birthday['2'] == '00'}请选择{else}{$birthday['2']}日{/if}</span>
        <select name="birthdayday" id="birthdayDay">
        	<option></option>
        </select>
        <a href="javascript:void(0);" class="arrow"></a>
      </div>
    </div>
    <div class="btn" id="userInfoBtn"><a href="javascript:">确定</a></div>
    </form>
</div>
{include_core file="m/lib/footer.html"}